/**
 * @Author: wangliuyang
 * @Date: 2021/8/17 22:18
 * @Description:
 */
public class Solution_551 {
    public boolean checkRecord(String s) {
        int p = 0;
        char[] chars = s.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] == 'A') {
                p++;
            }
            if (p == 2) {
                return false;
            }
        }
        return s.indexOf("LLL") == -1 ? true : false;
    }
    public boolean checkRecord2(String s) {
        int p = 0,l = 0;
        char[] chars = s.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] == 'A') {
                p++;
            }
            if (p == 2) {
                return false;
            }
            if (chars[i] == 'L') {
                l++;
                if (l == 3) {
                    return false;
                }
            }else {
                l = 0;
            }
        }
        return true;
    }
}

